package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.yangzihui.TopicDetailPo;
import com.cskaoyan.bean.yangzihui.TopicDetailRelatedPo;
import com.cskaoyan.bean.yangzihui.TopicPo;
import com.cskaoyan.service.WxTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yangzihui
 * @Description
 * @Create 2022-06-30 9:29
 * @Version
 */
@RestController
@RequestMapping("wx/topic")
public class WxTopicController {

    @Autowired
    WxTopicService wxtopicService;

    /**
     * 专题首界面
     * @param page
     * @param limit
     * @return
     */
    @RequestMapping("list")
    public BaseRespVo list(Integer page, Integer limit){
        TopicPo topicPo = wxtopicService.list(page,limit);
        return BaseRespVo.ok(topicPo);
    }

    /**
     * 专题的详情页面
     * @param id
     * @return
     */
    @RequestMapping("detail")
    public BaseRespVo detail(Integer id){
        TopicDetailPo topicDetailPo = wxtopicService.detail(id);
        return BaseRespVo.ok(topicDetailPo);
    }

    @RequestMapping("related")
    public BaseRespVo related(Integer id){
        TopicDetailRelatedPo topicDetailRelatedPo = wxtopicService.related(id);
        return BaseRespVo.ok(topicDetailRelatedPo);
    }
}
